package lesson.web;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.widget.Toast;

public class WebActivity extends Activity implements View.OnClickListener,
										   DialogInterface.OnClickListener {
    /** Called when the activity is first created. */
	WebView spider;
	Context cxt;
	static int counter=0;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        spider = (WebView) findViewById(R.id.webView1);
        spider.loadUrl("http://www.internaldrive.com/");
        cxt=this;
        findViewById(R.id.button1).setOnClickListener(this); 
    }

	public void onClick(View arg0) {
		// TODO Auto-generated method stub
		counter++;
		AlertDialog.Builder bob = new AlertDialog.Builder(this).setTitle((CharSequence) ("I AM DIALOG "+counter));
		bob.setMessage((CharSequence) "HEAR ME RAWR!");
		bob.setNegativeButton((CharSequence) "SHUT UP", new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface arg0, int arg1) {
				for (int i=0; i<15; i++) Toast.makeText(cxt, "I HATE YOU TOO!!\nMEANIE", Toast.LENGTH_LONG).show();
			}
		});
		bob.setPositiveButton((CharSequence) "AAAAAHHHH!", this);
		bob.show();
	}

	public void onClick(DialogInterface dialog, int which) {
		// TODO Auto-generated method stub
		counter++;
		AlertDialog.Builder bob = new AlertDialog.Builder(this).setTitle((CharSequence) ("I AM DIALOG "+counter));
		bob.setMessage((CharSequence) "HEAR ME RAWR!");
		bob.setNegativeButton((CharSequence) "SHUT UP", new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface arg0, int arg1) {
				for (int i=0; i<15; i++) Toast.makeText(cxt, "I HATE YOU TOO!!\nMEANIE", Toast.LENGTH_LONG).show();
			}
		});
		bob.setPositiveButton((CharSequence) "AAAAAHHHH!", this);
		bob.show();
	}
}